<%@page import="org.springframework.context.annotation.Bean"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="cn.egame.common.model.PageData"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Date"%>
<%@page import="cn.egame.ext.op.OperationActivityInfo"%>
<%@page import="com.egame.manage.biz.server.pu.ParameterServiceImpl"%>
<%@page import="com.egame.manage.biz.utils.ConstVar"%>
<%@page import="cn.egame.ext.EnumTypeExt"%>
<%@page import="cn.egame.common.util.Utils"%>
<%@page import="com.egame.manage.biz.server.UserServiceImpl"%>
<%@page import="com.egame.manage.biz.utils.ConstVar"%>
<%@page import="cn.egame.ext.op.AdvDetail"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath() %>/css/main.css"  />
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/My97DatePicker/WdatePicker.js"></script>
<title>广告活动列表</title>
<script type="text/javascript">

	function search(){
		document.getElementById("myform").action = "<%=request.getContextPath() + "/store/quick/advertise/list.do" %>";
		document.getElementById("myform").submit();
	}
	function formSubmit(id,url){
		$("#sortId").attr("value",id);
		document.getElementById("myform").action = url;
		document.getElementById("myform").submit();
	}
</script>
</head>
<body>
<form action="" id="myform">	
<input name="id" id="sortId" type="hidden" value="">
	<div class="matter_box">
		<h3 class="nopoint"><strong>彩蛋>小编</strong></h3>
		
			<% 
			String banner = "";
			if(request.getAttribute("banner")!=null){
				banner = (String)request.getAttribute("banner");
			}
			String beginTime = "";
			if(request.getAttribute("beginTime")!=null && ((String)request.getAttribute("beginTime")).trim().length()>0){
				beginTime = (String)request.getAttribute("beginTime");
				Date beginDate = Utils.parseDate(beginTime);
				beginTime = Utils.toDateString(beginDate,"yyyy-MM-dd HH:mm:ss");
			}
			String endTime = "";
			if(request.getAttribute("endTime")!=null && ((String)request.getAttribute("endTime")).trim().length()>0){
				endTime = (String)request.getAttribute("endTime");
				Date endDate = Utils.parseDate(endTime);
				endTime = Utils.toDateString(endDate,"yyyy-MM-dd HH:mm:ss");
			}
		%>
		<div class="task_search">
            	<span>标题：</span> 
				<input id="advert_banner" name="banner" class="input" type="text" value=<%=banner %>>
				<span>开始时间：</span>
				<input type="text" name="beginTime" id="advert_beginTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="Wdate" readonly="readonly" value="<%=beginTime %>">
				<span>结束时间：</span>
				<input type="text" name="endTime" id="advert_endTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="Wdate"  readonly="readonly" value="<%=endTime %>">
				<span>
	        		<input type=button value="查询" onclick="search()" class="upload_btn">
	        	</span>
          	</div>	
        <p class="tr">	
			<a class="btn2" href="<%=request.getContextPath() + "/store/quick/advertise/history/list.do"%>">历史记录</a>
			<a class="btn2" href="<%=request.getContextPath() + "/store/quick/advertise/set/show.do"%>">新增</a>
		</p>
		<div class="matter_text clearfix nobg mart">
			<table cellpadding="0" cellspacing="0" class="table2" id="rights_list">
				<tr class="first">
					<th>序号</th>
					<th>小编标题</th>
					<th>开始时间</th>
					<th>结束时间</th>
					<th>操作人</th>
					<th>操作时间</th>
					<th>操作</th>
				</tr>
	<%
		if(request.getAttribute("advHomeList1")!= null){
			List<AdvDetail> advHomeList1 = (List<AdvDetail>) request.getAttribute("advHomeList1");
			if(advHomeList1 != null){
				int i = 1;
				for(AdvDetail bean:advHomeList1){
					%>
					<tr>
						<td align=center><%=i++ %></td>
						<td align=center>
							<a href="javascript:formSubmit(<%=bean.getId() %>,'<%=request.getContextPath() + "/store/quick/advertise/edit/show.do?id=" + bean.getId()%>')"><%=bean.getTitle()%></a>
						</td>
						<% 
							String begintime = "";
							if(bean.getBeginTime() != null){
								begintime = Utils.toDateString(bean.getBeginTime(),"yyyy-MM-dd HH:mm:ss");
							}
							String endtime = "";
							if(bean.getEndTime() != null){
								endtime = Utils.toDateString(bean.getEndTime(),"yyyy-MM-dd HH:mm:ss");
							}
							String operatetime = "";
							if(bean.getUpdateTime() != null){
								operatetime = Utils.toDateString(bean.getUpdateTime(),"yyyy-MM-dd HH:mm:ss");
							}
						%>
						<td align=center><%=begintime %></td>
						<td align=center><%=endtime %></td>
						<td align=center></td>
						<td align=center><%=operatetime %></td>
						
						<td align=center>
							<a href="javascript:formSubmit(<%=bean.getId() %>,'<%=request.getContextPath() + "/store/quick/advertise/edit/show.do?id=" + bean.getId()%>')">编辑</a>
							<a href="javascript:formSubmit(<%=bean.getId() %>,'<%=request.getContextPath() + "/store/quick/advertise/delete.do?id=" + bean.getId()%>')">删除</a>
							<a href="javascript:formSubmit(<%=bean.getId() %>,'<%=request.getContextPath() + "/store/quick/advertise/upper.do?id=" + bean.getId()%>')">上移</a>
							<a href="javascript:formSubmit(<%=bean.getId() %>,'<%=request.getContextPath() + "/store/quick/advertise/lower.do?id=" + bean.getId()%>')">下移</a>
						</td>
							
					</tr>
					<%
				}
			}
		}
	%>
</table>
<%@ include file="../../page.in"  %> 
</div>
</div>
</form>
</body>
</html>